import React from 'react';
import { inject, observer } from 'mobx-react';
import * as mobx from 'mobx';
import ErrorMsg from './ErrorMsg';
import ConfirmInfo from './ConfirmInfo';
import EditLock from './EditLock';
import SubmitInfo from './SubmitInfo';
import RejectInfo from './RejectInfo';
import AgentInfo from "./AgentInfo";
import SecondAuthInfo from "./SecondAuthInfo";
import SubmitShowInfo from './SubmitShowInfo';
import FreeWorkflowSimpleInfo from "./FreeWorkflowSimpleInfo";
import {message} from 'antd';
import './index.less';

export default class Main extends React.Component {
    render() {
        const { promptInfos = [], secondAuthInfo} = this.props;
        let domarr = [];
        if (secondAuthInfo) {
            domarr.push(<SecondAuthInfo ecId={`${this && this.props && this.props.ecId || ''}_SecondAuthInfo@gufzb3@c1`} {...mobx.toJS(secondAuthInfo)} />);
        } 
        promptInfos.map(item => {
            const { prompttype } = item;
            prompttype === "errormsg" && domarr.push(<ErrorMsg ecId={`${this && this.props && this.props.ecId || ''}_ErrorMsg@w7f7d4@c2`} {...item} />);
            // prompttype === "confirminfo" && domarr.push(<ConfirmInfo {...item} />);
            prompttype === "editlock" && domarr.push(<EditLock ecId={`${this && this.props && this.props.ecId || ''}_EditLock@hx8ss9@c3`} {...item} />);
            prompttype === "submitinfo" && domarr.push(<SubmitInfo ecId={`${this && this.props && this.props.ecId || ''}_SubmitInfo@z123uj@c4`} {...item} />);
            prompttype === "rejectinfo" && domarr.push(<RejectInfo ecId={`${this && this.props && this.props.ecId || ''}_RejectInfo@h8irmr@c5`} {...item} />);
            prompttype === "agentinfo" && domarr.push(<AgentInfo ecId={`${this && this.props && this.props.ecId || ''}_AgentInfo@amke2a@c6`} {...item} />);
            prompttype === "showContent" && domarr.push(<SubmitShowInfo {...item} />);
            prompttype === "freeWorkflowSimpleInfo" && domarr.push(<FreeWorkflowSimpleInfo ecId={`${this && this.props && this.props.ecId || ''}_FreeWorkflowSimpleInfo@ugnx8b@c7`} {...item} />);
        })
        return domarr;
    }
}